//
//  BindDeviceView.m
//  NuwaRobot
//
//  Created by Kendama on 2017/12/5.
//  Copyright © 2017年 Kendama. All rights reserved.
//

#import "BindDeviceView.h"

@implementation BindDeviceView

- (UILabel *)titleLabel
{
    if(!_titleLabel)
    {
        UIView *superView = self;
        _titleLabel = [[UILabel alloc]init];
        [superView addSubview:_titleLabel];
        [_titleLabel setFont:fontWithSize(18)];
        [_titleLabel setTextColor:[UIColor whiteColor]];
        _titleLabel.text = @"绑定小天机器人";
    }
    return _titleLabel;
}
- (UIImageView *)logoImageView
{
    if(!_logoImageView)
    {
        UIView *superView = self;
        _logoImageView = [[UIImageView alloc]init];
        [superView addSubview:_logoImageView];
        _logoImageView.image = [UIImage imageNamed:@"icon_logo"];
    }
    return _logoImageView;
}
- (UIButton *)scanButton
{
    if(!_scanButton)
    {
        UIView *superView = self;
        _scanButton = [[UIButton alloc]init];
        [superView addSubview:_scanButton];
        [_scanButton setTitle:@"扫码绑定小天" forState:UIControlStateNormal];
        [_scanButton setImage:imageWithName(@"icon_saoma") forState:UIControlStateNormal];
        [_scanButton.titleLabel setFont:fontCommonSize];
        [_scanButton setBackgroundColor:rgba(0,159,236,1)];
        [_scanButton layoutButtonWithEdgeInsetsStyle:MKButtonEdgeInsetsStyleLeft imageTitleSpace:10];
    }
    return _scanButton;
}

- (void)masLayoutSubview
{
    __weak UIView *superView = self;
    superView.backgroundColor = rgba(6,27,56,1);
    
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(superView.mas_top).with.offset(px1920Height(100));
        make.centerX.mas_equalTo(superView.mas_centerX);
    }];
    
    [self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.titleLabel.mas_bottom).with.offset(px1920Height(50));
        make.centerX.mas_equalTo(superView.mas_centerX);
        make.height.mas_equalTo(px1920Height(543));
        make.width.mas_equalTo(px1080Width(966));
    }];
    
    [self.scanButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.logoImageView.mas_bottom).with.offset(px1920Height(150));
        make.centerX.mas_equalTo(superView.mas_centerX);
        make.height.mas_equalTo(px1920Height(136));
        make.width.mas_equalTo(px1080Width(900));
    }];
}


@end
